<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>知识增强的文本生成报告笔记 | zapqwe block</title><meta name="author" content="laptony"><meta name="copyright" content="laptony"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="知识增强的文本生成报告笔记">
<meta property="og:type" content="article">
<meta property="og:title" content="知识增强的文本生成报告笔记">
<meta property="og:url" content="https://sswd123.gitee.io/posts/29414/index.html">
<meta property="og:site_name" content="zapqwe block">
<meta property="og:description" content="知识增强的文本生成报告笔记">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/5af17f7f881b11ebb6edd017c2d2eca2.jpg">
<meta property="article:published_time" content="2023-01-14T09:44:54.000Z">
<meta property="article:modified_time" content="2023-01-20T09:02:55.055Z">
<meta property="article:author" content="laptony">
<meta property="article:tag" content="AI">
<meta property="article:tag" content="text_generation">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/5af17f7f881b11ebb6edd017c2d2eca2.jpg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://sswd123.gitee.io/posts/29414/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//fonts.googleapis.com" crossorigin=""/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium+Web&amp;display=swap" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '知识增强的文本生成报告笔记',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-01-20 17:02:55'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><!-- -音乐--><div class="aplayer" data-id="7455077979" data-server="tencent" data-type="playlist" data-fixed="true" data-listFolded="false" data-order="random" data-preload="none"></div><link rel="stylesheet" href="https://cdn.bootcss.com/aplayer/1.10.1/APlayer.min.css"><script src="https://cdn.bootcss.com/aplayer/1.10.1/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/npm/meting@1.2.0/dist/Meting.min.js"></script><link rel="stylesheet" href="/css/font.css"><!-- hexo injector head_end start --><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-double-row-display@1.00/cardlistpost.min.css"/>
<style>#recent-posts > .recent-post-item >.recent-post-info > .article-meta-wrap > .tags:before {content:"\A";
  white-space: pre;}#recent-posts > .recent-post-item >.recent-post-info > .article-meta-wrap > .tags > .article-meta__separator{display:none}</style>
<!-- hexo injector head_end end --><meta name="generator" content="Hexo 6.3.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><script>const preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',()=> { preloader.endLoading() })

if (true) {
  document.addEventListener('pjax:send', () => { preloader.initLoading() })
  document.addEventListener('pjax:complete', () => { preloader.endLoading() })
}</script><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/11.gif" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">12</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">9</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">3</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-homef"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/photos/"><i class="fa-fw fas fa-camera"></i><span> 图库</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> List</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> Music</span></a></li></ul></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/5af17f7f881b11ebb6edd017c2d2eca2.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">zapqwe block</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-homef"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/photos/"><i class="fa-fw fas fa-camera"></i><span> 图库</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> List</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> Music</span></a></li></ul></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">知识增强的文本生成报告笔记</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-01-14T09:44:54.000Z" title="发表于 2023-01-14 17:44:54">2023-01-14</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-01-20T09:02:55.055Z" title="更新于 2023-01-20 17:02:55">2023-01-20</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E7%AC%94%E8%AE%B0/">笔记</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>8分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="知识增强的文本生成报告笔记"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h2 id="摘要"><a href="#摘要" class="headerlink" title="摘要"></a>摘要</h2><p>应用: 对话、总结和翻译<br>方法: encoder-decoder model，内部知识，外部知识<br>主要内容： 将知识集成到文本生成中的一般方法和体系结构；根据不同形式的知识数据进行具体的技术和应用</p>
<h2 id="1-引言"><a href="#1-引言" class="headerlink" title="1 引言"></a>1 引言</h2><p> sequence-to-sequence：编码器将输入序列映射到固定大小的向量，解码器将向量映射到目标序列。<br> 流行的体系结构：RNN,CNN,Transformer<br> 通常情况下，需要输入序列之外的知识才能产生有信息的输出文本</p>
<h3 id="什么是知识增强文本生成"><a href="#什么是知识增强文本生成" class="headerlink" title="什么是知识增强文本生成?"></a>什么是知识增强文本生成?</h3><p> 知识是对输入文本及其周围语境的认识和理解。这些知识来源可以分为内部知识和外部知识。见下图<br> <img src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/20230114180226.png"><br> 将知识整合到文本生成中这一研究方向被命名知识增强文本生成。<br> 挑战：从不同的渠道获取有用的相关知识；有效地理解和利用所获得的知识，以促进文本生成</p>
<h2 id="2-将知识集成到NLG中的一般方法"><a href="#2-将知识集成到NLG中的一般方法" class="headerlink" title="2 将知识集成到NLG中的一般方法"></a>2 将知识集成到NLG中的一般方法</h2><h3 id="基本文本生成模型"><a href="#基本文本生成模型" class="headerlink" title="基本文本生成模型"></a>基本文本生成模型</h3><p>Seq2Seq<br>Encoder:编码器学会将可变长度序列编码为固定长度的向量表示。<br><img src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/20230115083428.png"><br>Decoder:解码器是将给定的固定长度向量表示解码为可变长度序列<br><img src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/20230115083625.png"><br>优化器：生成过程被看作是一个连续的多标签分类问题<br><img src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/20230115084303.png"></p>
<h3 id="知识增强的模型体系结构、"><a href="#知识增强的模型体系结构、" class="headerlink" title="知识增强的模型体系结构、"></a>知识增强的模型体系结构、</h3><h4 id="知识相关的注意机制："><a href="#知识相关的注意机制：" class="headerlink" title="知识相关的注意机制："></a>知识相关的注意机制：</h4><p>结合知识(主题，关键字，知识库，知识图谱，相关文本),总体思想是学习一个知识感知的上下文向量,通过结合隐藏上下文向量和知识情境向量，进入解码器更新。<br><img src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/20230115202208.png"></p>
<h4 id="复制和指向机制（CopyNet-and-PG）："><a href="#复制和指向机制（CopyNet-and-PG）：" class="headerlink" title="复制和指向机制（CopyNet and PG）："></a>复制和指向机制（CopyNet and PG）：</h4><p>用于选择输入序列中的子序列，并将它们放在输出序列中的适当位置。<br><img src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/20230115204931.png"><br>知识相关模式<br><img src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/20230115205428.png"></p>
<h4 id="记忆网络-Memory-Network"><a href="#记忆网络-Memory-Network" class="headerlink" title="记忆网络(Memory Network)"></a>记忆网络(Memory Network)</h4><p>注意模型建立在一个可能很大的外部记忆上，把外部记忆写入几个嵌入矩阵，使用查询向量，读取记忆向量</p>
<h4 id="图神经网络"><a href="#图神经网络" class="headerlink" title="图神经网络"></a>图神经网络</h4><h4 id="预训练语言模型"><a href="#预训练语言模型" class="headerlink" title="预训练语言模型"></a>预训练语言模型</h4><p>通过对大规模无标签语料库进行自我监督训练，学习通用语言表示。</p>
<h3 id="知识增强学习和推理"><a href="#知识增强学习和推理" class="headerlink" title="知识增强学习和推理"></a>知识增强学习和推理</h3><p>除了专门的模型架构之外，向生成模型注入知识的一种常用方法是通过监督知识学习，可以将知识编码到目标函数中，指导模型训练以获得所需的模型行为，可以根据知识设计学习任务，训练模型获取知识信息。</p>
<h4 id="学习与知识相关的任务"><a href="#学习与知识相关的任务" class="headerlink" title="学习与知识相关的任务"></a>学习与知识相关的任务</h4><p>以知识为目标：<br><img src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/20230115213220.png"><br>以知识为条件：<br><img src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/20230115213756.png"></p>
<h4 id="在知识约束下学习"><a href="#在知识约束下学习" class="headerlink" title="在知识约束下学习"></a>在知识约束下学习</h4><p>知识作为约束来正则化文本生成训练目标<br>The posterior regularization (PR) framework </p>
<h2 id="3-内部知识增强的文本生成"><a href="#3-内部知识增强的文本生成" class="headerlink" title="3 内部知识增强的文本生成"></a>3 内部知识增强的文本生成</h2><h3 id="文本生成增强通过主题"><a href="#文本生成增强通过主题" class="headerlink" title="文本生成增强通过主题"></a>文本生成增强通过主题</h3><p>主题作为文本的一种代表性或压缩形式，经常被用于保持语义连贯和指导nlp过程。一个经典的主题模型， Latent Dirichlet allocation (LDA)，根据文档的主题分布和主题的单词分布生成文档中的单词。<br>具有严格的概率解释，因为单词和文档的语义表示都组合到一个统一的框架中。此外，主题模型可以很容易地使用和集成到生成框架中。例如，主题词可以表示为词嵌入;主题嵌入可以通过主题关注集成到解码阶段。但是LDA模型脱离了生成的训练过程，不能适应输入输出序列之间依赖关系的多样性。<br><img src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/20230117164517.png"></p>
<h4 id="利用生成主题模型中的主题词"><a href="#利用生成主题模型中的主题词" class="headerlink" title="利用生成主题模型中的主题词"></a>利用生成主题模型中的主题词</h4><p>主题在一定程度上有助于理解句子的语义，确定句子的语义谱。对于增强文本生成，一个有效的解决方案是首先使用生成主题(LDA)模型发现主题，然后将主题表示纳入神经生成模型，在现有的工作中，有两种主流的方法来表示从生成主题模型中获得的主题。第一种方法是在输入序列中为每个单词使用生成的主题分布，第二种方法是给输入序列指定一个特定的主题，主题下概率最高的top-k单词，使用词嵌入表示主题词,明确地使用主题词可以带来比主题分布更强的引导，但当一些生成的主题词不相关时，引导可能会偏离目标输出序列。</p>
<h4 id="联合优化生成模型和CNN主题模型"><a href="#联合优化生成模型和CNN主题模型" class="headerlink" title="联合优化生成模型和CNN主题模型"></a>联合优化生成模型和CNN主题模型</h4><p>(LDA)不能适应输入和输出序列之间依赖关系的多样性。因此，解决这个问题的想法是使用神经主题模型。<br>是一个端到端的神经框架，同时学习潜在的主题表示并生成输出序列。卷积神经网络(CNN)通常通过迭代卷积和池化操作来生成潜在主题。但是，由于缺乏理论分析，无法保证卷积所捕获的主题的质量。而且它们的可解释性不如基于lda的主题模型。</p>
<h4 id="基于变分推理的神经主题模型增强"><a href="#基于变分推理的神经主题模型增强" class="headerlink" title="基于变分推理的神经主题模型增强"></a>基于变分推理的神经主题模型增强</h4><p>神经主题模型结合了神经网络和概率主题模型的优点。它们支持反向传播以进行联合优化，有助于形成更连贯的主题，并且可以扩展到大型数据集。一般来说，神经话题模型比LDAs能提供更好的话题连贯性. 然而，神经变分方法有一个相同的缺点，即主题分布假设为各向同性高斯分布，这使得它们无法对主题相关性建模</p>
<h3 id="文本生成增强通过关键字"><a href="#文本生成增强通过关键字" class="headerlink" title="文本生成增强通过关键字"></a>文本生成增强通过关键字</h3><p>文档关键字获取的主流方法可以分为两类：关键字分配和关键字提取。关键字分配意味着从受控词汇表或预定义的分类法中选择关键字。关键字提取选择文档中明确显示的最具代表性的单词，它独立于任何词汇表。<br>关键字分配的主要优点是保证了关键字的质量，因为不相关的关键字不会包含在预定义的词汇表中。<br>另一个优点是，即使两个语义相似的文档没有通用单词，也可以为它们分配相同的关键字。然而，主要有两个缺点。一方面，在新域中创建和维护字典是昂贵的。因此，字典可能无法使用。另一方面，文档中出现的潜在关键字如果不在词汇表中，就会被忽略。因此，关键字分配适合于需要特定类别的关键字来引导生成的带有这些关键信息的句子的任务。例如，对话系统产生带有特定态度的反应。<br>关键字提取选择文档中明确显示的最具代表性的单词，它独立于任何词汇表。它易于使用，但有两个缺点。首先，它不能保证一致性，因为如果相似的文档不共享同一组单词，它们仍然可能由不同的关键字表示。其次，当输入文档没有适当的代表性单词，并且不幸的是，关键字提取器从文档中选择了不相关的单词作为关键字时，这种错误的指导将会误导生成。因此，关键字提取适用于输出序列需要在输入序列中保留重要信息的任务，如文档摘要和释义。</p>
<h3 id="文本生成增强通过语言特征"><a href="#文本生成增强通过语言特征" class="headerlink" title="文本生成增强通过语言特征"></a>文本生成增强通过语言特征</h3><p>特征丰富编码器意味着编码器不仅读取输入序列，而且还包含辅助手工制作的特征。语言特征是最常见的手工特征，比如词性，依赖项解析和语义解析。</p>
<h4 id="POS-tags-and-NER-tags"><a href="#POS-tags-and-NER-tags" class="headerlink" title="POS tags and NER tags"></a>POS tags and NER tags</h4><p>词性标注，分配标记标记以指示标记的语法类别和词性，如名词(N)，动词(V)，形容词(A)。Named-entity识别(NER)将非结构化文本中提到的命名实体划分为预先定义的类别，如person(P), location (L), organization (O).尽管存在同音异义和构词过程，但几种词类型之间可能共享相同的表面构词形式。结合NER标记和POS标记可以更好地检测命名实体和理解输入序列，从而进一步改进NLG。</p>
<h4 id="语法依赖关系图"><a href="#语法依赖关系图" class="headerlink" title="语法依赖关系图"></a>语法依赖关系图</h4><p>句法依赖图是表示词与词之间句法关系的有向无环图，在NLG任务中，依赖关系信息通常以以下三种不同的方式建模，线性化表示:线性化依赖关系图，然后使用序列模型得到语法感知的表示；基于路径表示:根据单词与对齐中心位置的线性距离计算注意权重，即单词在依赖图上与中心位置的距离越大，单词对上下文向量的贡献就越小；基于图的表示:使用gnn从依赖关系中聚合信息。</p>
<h4 id="语义依赖图"><a href="#语义依赖图" class="headerlink" title="语义依赖图"></a>语义依赖图</h4><p>由于语义依赖图引入了更高层次的信息抽象，捕捉了相同基础谓词-参数结构的不同实现之间的共性，因此它已被广泛用于改进文本生成，</p>
<h3 id="文本生成增强通过知识图谱"><a href="#文本生成增强通过知识图谱" class="headerlink" title="文本生成增强通过知识图谱"></a>文本生成增强通过知识图谱</h3><p>内部KG被定义为完全基于输入文本构造的KG。内部KG在理解输入序列中起着重要作用，特别是当输入序列很长时。通过构建一个内部KG中介，可以合并或丢弃冗余信息，从而生成一个经过大量压缩的表单来表示输入文档。此外，当与同一实体相关的复杂事件可能跨越多个句子时，在kg上的表示可以产生一个结构化的总结，突出相关概念的接近性。构建内部KG的主流方法之一是使用开放信息抽取。与传统的信息提取(IE)方法不同，OpenIE并不局限于预先已知的一小部分目标实体和关系，而是提取输入文本中发现的所有类型的实体和关系，通过这种方式，OpenIE促进了从文本中提取的关系的领域独立发现，并扩展到大型异构语料库。在获得内部KG后，下一步是学习内部KG的表示，并将其集成到生成模型中。</p>
<h2 id="4-外部知识增强的文本生成"><a href="#4-外部知识增强的文本生成" class="headerlink" title="4 外部知识增强的文本生成"></a>4 外部知识增强的文本生成</h2><h3 id="文本生成增强通过知识库"><a href="#文本生成增强通过知识库" class="headerlink" title="文本生成增强通过知识库"></a>文本生成增强通过知识库</h3><p>NLG中最大的挑战之一是发现序列内元素和输入输出序列之间的依赖关系.<br>问答系统：由于缺乏常识&#x2F;事实知识，仅将输入问题纳入神经生成模型往往无法完成任务,常识和事实的相关结构化信息可以从知识库(KB)检索到。<br>对话系统：</p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="https://sswd123.gitee.io">laptony</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://sswd123.gitee.io/posts/29414/">https://sswd123.gitee.io/posts/29414/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://sswd123.gitee.io" target="_blank">zapqwe block</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/AI/">AI</a><a class="post-meta__tags" href="/tags/text-generation/">text_generation</a></div><div class="post_share"><div class="social-share" data-image="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/5af17f7f881b11ebb6edd017c2d2eca2.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/13.jpg" target="_blank"><img class="post-qr-code-img" src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/13.jpg" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/12.jpg" target="_blank"><img class="post-qr-code-img" src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/12.jpg" alt="支付宝"/></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/posts/27840/"><img class="prev-cover" src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/5af17f7f881b11ebb6edd017c2d2eca2.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">huggingface_transformer笔记</div></div></a></div><div class="next-post pull-right"><a href="/posts/biyesheji/"><img class="next-cover" src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/20230104211136.png" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">毕业设计</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/posts/10059/" title="AI笔记"><img class="cover" src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/A547B66ABDA63D737A9376686FDA3736.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2023-01-09</div><div class="title">AI笔记</div></div></a></div><div><a href="/posts/27840/" title="huggingface_transformer笔记"><img class="cover" src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/5af17f7f881b11ebb6edd017c2d2eca2.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2023-01-20</div><div class="title">huggingface_transformer笔记</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div class="vcomment" id="vcomment"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/11.gif" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">laptony</div><div class="author-info__description">敏于思考，锐于实现</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">12</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">9</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">3</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/zapqqqwe"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/zapqqqwe" target="_blank" title="Github"><i class="fas fa-github"></i></a><a class="social-icon" href="mailto:2496524403@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">折腾中学会知识，互访中找到友情，写作中读懂人生，坚持中找到方向。</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%91%98%E8%A6%81"><span class="toc-number">1.</span> <span class="toc-text">摘要</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#1-%E5%BC%95%E8%A8%80"><span class="toc-number">2.</span> <span class="toc-text">1 引言</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BB%80%E4%B9%88%E6%98%AF%E7%9F%A5%E8%AF%86%E5%A2%9E%E5%BC%BA%E6%96%87%E6%9C%AC%E7%94%9F%E6%88%90"><span class="toc-number">2.1.</span> <span class="toc-text">什么是知识增强文本生成?</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-%E5%B0%86%E7%9F%A5%E8%AF%86%E9%9B%86%E6%88%90%E5%88%B0NLG%E4%B8%AD%E7%9A%84%E4%B8%80%E8%88%AC%E6%96%B9%E6%B3%95"><span class="toc-number">3.</span> <span class="toc-text">2 将知识集成到NLG中的一般方法</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E6%96%87%E6%9C%AC%E7%94%9F%E6%88%90%E6%A8%A1%E5%9E%8B"><span class="toc-number">3.1.</span> <span class="toc-text">基本文本生成模型</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%9F%A5%E8%AF%86%E5%A2%9E%E5%BC%BA%E7%9A%84%E6%A8%A1%E5%9E%8B%E4%BD%93%E7%B3%BB%E7%BB%93%E6%9E%84%E3%80%81"><span class="toc-number">3.2.</span> <span class="toc-text">知识增强的模型体系结构、</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%9F%A5%E8%AF%86%E7%9B%B8%E5%85%B3%E7%9A%84%E6%B3%A8%E6%84%8F%E6%9C%BA%E5%88%B6%EF%BC%9A"><span class="toc-number">3.2.1.</span> <span class="toc-text">知识相关的注意机制：</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%A4%8D%E5%88%B6%E5%92%8C%E6%8C%87%E5%90%91%E6%9C%BA%E5%88%B6%EF%BC%88CopyNet-and-PG%EF%BC%89%EF%BC%9A"><span class="toc-number">3.2.2.</span> <span class="toc-text">复制和指向机制（CopyNet and PG）：</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%B0%E5%BF%86%E7%BD%91%E7%BB%9C-Memory-Network"><span class="toc-number">3.2.3.</span> <span class="toc-text">记忆网络(Memory Network)</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9B%BE%E7%A5%9E%E7%BB%8F%E7%BD%91%E7%BB%9C"><span class="toc-number">3.2.4.</span> <span class="toc-text">图神经网络</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%A2%84%E8%AE%AD%E7%BB%83%E8%AF%AD%E8%A8%80%E6%A8%A1%E5%9E%8B"><span class="toc-number">3.2.5.</span> <span class="toc-text">预训练语言模型</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%9F%A5%E8%AF%86%E5%A2%9E%E5%BC%BA%E5%AD%A6%E4%B9%A0%E5%92%8C%E6%8E%A8%E7%90%86"><span class="toc-number">3.3.</span> <span class="toc-text">知识增强学习和推理</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%AD%A6%E4%B9%A0%E4%B8%8E%E7%9F%A5%E8%AF%86%E7%9B%B8%E5%85%B3%E7%9A%84%E4%BB%BB%E5%8A%A1"><span class="toc-number">3.3.1.</span> <span class="toc-text">学习与知识相关的任务</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9C%A8%E7%9F%A5%E8%AF%86%E7%BA%A6%E6%9D%9F%E4%B8%8B%E5%AD%A6%E4%B9%A0"><span class="toc-number">3.3.2.</span> <span class="toc-text">在知识约束下学习</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-%E5%86%85%E9%83%A8%E7%9F%A5%E8%AF%86%E5%A2%9E%E5%BC%BA%E7%9A%84%E6%96%87%E6%9C%AC%E7%94%9F%E6%88%90"><span class="toc-number">4.</span> <span class="toc-text">3 内部知识增强的文本生成</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E6%9C%AC%E7%94%9F%E6%88%90%E5%A2%9E%E5%BC%BA%E9%80%9A%E8%BF%87%E4%B8%BB%E9%A2%98"><span class="toc-number">4.1.</span> <span class="toc-text">文本生成增强通过主题</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%A9%E7%94%A8%E7%94%9F%E6%88%90%E4%B8%BB%E9%A2%98%E6%A8%A1%E5%9E%8B%E4%B8%AD%E7%9A%84%E4%B8%BB%E9%A2%98%E8%AF%8D"><span class="toc-number">4.1.1.</span> <span class="toc-text">利用生成主题模型中的主题词</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%81%94%E5%90%88%E4%BC%98%E5%8C%96%E7%94%9F%E6%88%90%E6%A8%A1%E5%9E%8B%E5%92%8CCNN%E4%B8%BB%E9%A2%98%E6%A8%A1%E5%9E%8B"><span class="toc-number">4.1.2.</span> <span class="toc-text">联合优化生成模型和CNN主题模型</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E4%BA%8E%E5%8F%98%E5%88%86%E6%8E%A8%E7%90%86%E7%9A%84%E7%A5%9E%E7%BB%8F%E4%B8%BB%E9%A2%98%E6%A8%A1%E5%9E%8B%E5%A2%9E%E5%BC%BA"><span class="toc-number">4.1.3.</span> <span class="toc-text">基于变分推理的神经主题模型增强</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E6%9C%AC%E7%94%9F%E6%88%90%E5%A2%9E%E5%BC%BA%E9%80%9A%E8%BF%87%E5%85%B3%E9%94%AE%E5%AD%97"><span class="toc-number">4.2.</span> <span class="toc-text">文本生成增强通过关键字</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E6%9C%AC%E7%94%9F%E6%88%90%E5%A2%9E%E5%BC%BA%E9%80%9A%E8%BF%87%E8%AF%AD%E8%A8%80%E7%89%B9%E5%BE%81"><span class="toc-number">4.3.</span> <span class="toc-text">文本生成增强通过语言特征</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#POS-tags-and-NER-tags"><span class="toc-number">4.3.1.</span> <span class="toc-text">POS tags and NER tags</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AF%AD%E6%B3%95%E4%BE%9D%E8%B5%96%E5%85%B3%E7%B3%BB%E5%9B%BE"><span class="toc-number">4.3.2.</span> <span class="toc-text">语法依赖关系图</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AF%AD%E4%B9%89%E4%BE%9D%E8%B5%96%E5%9B%BE"><span class="toc-number">4.3.3.</span> <span class="toc-text">语义依赖图</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E6%9C%AC%E7%94%9F%E6%88%90%E5%A2%9E%E5%BC%BA%E9%80%9A%E8%BF%87%E7%9F%A5%E8%AF%86%E5%9B%BE%E8%B0%B1"><span class="toc-number">4.4.</span> <span class="toc-text">文本生成增强通过知识图谱</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#4-%E5%A4%96%E9%83%A8%E7%9F%A5%E8%AF%86%E5%A2%9E%E5%BC%BA%E7%9A%84%E6%96%87%E6%9C%AC%E7%94%9F%E6%88%90"><span class="toc-number">5.</span> <span class="toc-text">4 外部知识增强的文本生成</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E6%9C%AC%E7%94%9F%E6%88%90%E5%A2%9E%E5%BC%BA%E9%80%9A%E8%BF%87%E7%9F%A5%E8%AF%86%E5%BA%93"><span class="toc-number">5.1.</span> <span class="toc-text">文本生成增强通过知识库</span></a></li></ol></li></ol></div></div></div></div></main><footer id="footer" style="background-image: url('https://www-1305197828.cos.ap-beijing.myqcloud.com/imgs/5af17f7f881b11ebb6edd017c2d2eca2.jpg')"><div id="footer-wrap"><div class="copyright">&copy;2022 - 2023  <i id="heartbeat" class="fa fas fa-heartbeat"></i> laptony</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text">Hi, welcome to my  <a href="https://sswd123.gitee.io/">blog</a>!</div></div><head><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/HCLonely/images@master/others/heartbeat.min.css"></head></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.min.js"></script><script>function panguFn () {
  if (typeof pangu === 'object') pangu.autoSpacingPage()
  else {
    getScript('https://cdn.jsdelivr.net/npm/pangu/dist/browser/pangu.min.js')
      .then(() => {
        pangu.autoSpacingPage()
      })
  }
}

function panguInit () {
  if (false){
    GLOBAL_CONFIG_SITE.isPost && panguFn()
  } else {
    panguFn()
  }
}

document.addEventListener('DOMContentLoaded', panguInit)</script><script src="/js/search/local-search.js"></script><div class="js-pjax"><script>(() => {
  const $mermaidWrap = document.querySelectorAll('#article-container .mermaid-wrap')
  if ($mermaidWrap.length) {
    window.runMermaid = () => {
      window.loadMermaid = true
      const theme = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'default'

      Array.from($mermaidWrap).forEach((item, index) => {
        const mermaidSrc = item.firstElementChild
        const mermaidThemeConfig = '%%{init:{ \'theme\':\'' + theme + '\'}}%%\n'
        const mermaidID = 'mermaid-' + index
        const mermaidDefinition = mermaidThemeConfig + mermaidSrc.textContent
        mermaid.mermaidAPI.render(mermaidID, mermaidDefinition, (svgCode) => {
          mermaidSrc.insertAdjacentHTML('afterend', svgCode)
        })
      })
    }

    const loadMermaid = () => {
      window.loadMermaid ? runMermaid() : getScript('https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js').then(runMermaid)
    }

    window.pjax ? loadMermaid() : document.addEventListener('DOMContentLoaded', loadMermaid)
  }
})()</script><script>function loadValine () {
  function initValine () {
    const valine = new Valine(Object.assign({
      el: '#vcomment',
      appId: 'ouV9RVxe71Vu4hdUP93QtOs1-gzGzoHsz',
      appKey: 'laBz1asytkOHj9NfuZVJogqf',
      avatar: 'monsterid',
      serverURLs: '',
      emojiMaps: "",
      path: window.location.pathname,
      visitor: false
    }, null))
  }

  if (typeof Valine === 'function') initValine() 
  else getScript('https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js').then(initValine)
}

if ('Valine' === 'Valine' || !false) {
  if (false) btf.loadComment(document.getElementById('vcomment'),loadValine)
  else setTimeout(loadValine, 0)
} else {
  function loadOtherComment () {
    loadValine()
  }
}</script></div><script src="https://cdn.jsdelivr.net/npm/blueimp-md5/js/md5.min.js"></script><script>window.addEventListener('load', () => {
  const changeContent = (content) => {
    if (content === '') return content

    content = content.replace(/<img.*?src="(.*?)"?[^\>]+>/ig, '[图片]') // replace image link
    content = content.replace(/<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, '[链接]') // replace url
    content = content.replace(/<pre><code>.*?<\/pre>/gi, '[代码]') // replace code
    content = content.replace(/<[^>]+>/g,"") // remove html tag

    if (content.length > 150) {
      content = content.substring(0,150) + '...'
    }
    return content
  }

  const getIcon = (icon, mail) => {
    if (icon) return icon
    let defaultIcon = '?d=monsterid'
    let iconUrl = `https://gravatar.loli.net/avatar/${md5(mail.toLowerCase()) + defaultIcon}`
    return iconUrl
  }

  const generateHtml = array => {
    let result = ''

    if (array.length) {
      for (let i = 0; i < array.length; i++) {
        result += '<div class=\'aside-list-item\'>'

        if (true) {
          const name = 'src'
          result += `<a href='${array[i].url}' class='thumbnail'><img ${name}='${array[i].avatar}' alt='${array[i].nick}'></a>`
        }

        result += `<div class='content'>
        <a class='comment' href='${array[i].url}' title='${array[i].content}'>${array[i].content}</a>
        <div class='name'><span>${array[i].nick} / </span><time datetime="${array[i].date}">${btf.diffDate(array[i].date, true)}</time></div>
        </div></div>`
      }
    } else {
      result += '没有评论'
    }

    let $dom = document.querySelector('#card-newest-comments .aside-list')
    $dom.innerHTML= result
    window.lazyLoadInstance && window.lazyLoadInstance.update()
    window.pjax && window.pjax.refresh($dom)
  }

  const getComment = () => {
    const serverURL = 'https://ouV9RVxe.api.lncldglobal.com'

    var settings = {
      "method": "GET",
      "headers": {
        "X-LC-Id": 'ouV9RVxe71Vu4hdUP93QtOs1-gzGzoHsz',
        "X-LC-Key": 'laBz1asytkOHj9NfuZVJogqf',
        "Content-Type": "application/json"
      },
    }

    fetch(`${serverURL}/1.1/classes/Comment?limit=6&order=-createdAt`,settings)
      .then(response => response.json())
      .then(data => {
        const valineArray = data.results.map(function (e) {
          return {
            'avatar': getIcon(e.QQAvatar, e.mail),
            'content': changeContent(e.comment),
            'nick': e.nick,
            'url': e.url + '#' + e.objectId,
            'date': e.updatedAt,
          }
        })
        saveToLocal.set('valine-newest-comments', JSON.stringify(valineArray), 10/(60*24))
        generateHtml(valineArray)
      }).catch(e => {
        const $dom = document.querySelector('#card-newest-comments .aside-list')
        $dom.innerHTML= "无法获取评论，请确认相关配置是否正确"
      }) 
  }

  const newestCommentInit = () => {
    if (document.querySelector('#card-newest-comments .aside-list')) {
      const data = saveToLocal.get('valine-newest-comments')
      if (data) {
        generateHtml(JSON.parse(data))
      } else {
        getComment()
      }
    }
  }

  newestCommentInit()
  document.addEventListener('pjax:complete', newestCommentInit)
})</script><div><canvas id="snow" style="position:fixed;top:0;left:0;width:100%;height:100%;z-index:99999;pointer-events:none"></canvas></div><script>const notMobile = (!(navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)));</script><script async type="text/javascript" src="https://cdn.jsdelivr.net/gh/Candinya/Kratos-Rebirth@latest/source/js/snow.min.js"></script><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-fluttering-ribbon.min.js"></script><script id="canvas_nest" defer="defer" color="0,0,255" opacity="0.7" zIndex="-1" count="99" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-nest.min.js"></script><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/activate-power-mode.min.js"></script><script>POWERMODE.colorful = true;
POWERMODE.shake = true;
POWERMODE.mobile = false;
document.body.addEventListener('input', POWERMODE);
</script><script id="click-show-text" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/click-show-text.min.js" data-mobile="false" data-text="I,LOVE,YOU" data-fontsize="15px" data-random="false" async="async"></script><div class="aplayer" data-id="7455077979" data-server="tencent" data-type="playlist" data-fixed="true" data-listFolded="false" data-order="random" data-preload="none"></div><link rel="stylesheet" href="https://cdn.bootcss.com/aplayer/1.10.1/APlayer.min.css"><script src="https://cdn.bootcss.com/aplayer/1.10.1/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/npm/meting@1.2.0/dist/Meting.min.js"></script><script src="https://cdn.jsdelivr.net/npm/pjax/pjax.min.js"></script><script>let pjaxSelectors = ["head > title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show",".js-pjax"]

var pjax = new Pjax({
  elements: 'a:not([target="_blank"])',
  selectors: pjaxSelectors,
  cacheBust: false,
  analytics: false,
  scrollRestoration: false
})

document.addEventListener('pjax:send', function () {

  // removeEventListener scroll 
  window.tocScrollFn && window.removeEventListener('scroll', window.tocScrollFn)
  window.scrollCollect && window.removeEventListener('scroll', scrollCollect)

  document.getElementById('rightside').style.cssText = "opacity: ''; transform: ''"
  
  if (window.aplayers) {
    for (let i = 0; i < window.aplayers.length; i++) {
      if (!window.aplayers[i].options.fixed) {
        window.aplayers[i].destroy()
      }
    }
  }

  typeof typed === 'object' && typed.destroy()

  //reset readmode
  const $bodyClassList = document.body.classList
  $bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')

  typeof disqusjs === 'object' && disqusjs.destroy()
})

document.addEventListener('pjax:complete', function () {
  window.refreshFn()

  document.querySelectorAll('script[data-pjax]').forEach(item => {
    const newScript = document.createElement('script')
    const content = item.text || item.textContent || item.innerHTML || ""
    Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
    newScript.appendChild(document.createTextNode(content))
    item.parentNode.replaceChild(newScript, item)
  })

  GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()

  typeof chatBtnFn === 'function' && chatBtnFn()
  typeof panguInit === 'function' && panguInit()

  // google analytics
  typeof gtag === 'function' && gtag('config', '', {'page_path': window.location.pathname});

  // baidu analytics
  typeof _hmt === 'object' && _hmt.push(['_trackPageview',window.location.pathname]);

  typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()

  // prismjs
  typeof Prism === 'object' && Prism.highlightAll()
})

document.addEventListener('pjax:error', (e) => {
  if (e.request.status === 404) {
    pjax.loadUrl('/404.html')
  }
})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"/live2dw/assets/koharu.model.json"},"display":{"position":"left","width":100,"height":200},"mobile":{"show":true},"rect":{"opacity":0.5},"log":false});</script></body></html>